package com.gl.saasservice.sys.mapper;

import com.gl.saasservice.sys.vo.PermissionVO;
import org.springframework.jdbc.core.RowMapper;

import java.sql.ResultSet;
import java.sql.SQLException;

public class PermissionRowMapper implements RowMapper<PermissionVO> {

	@Override
	public PermissionVO mapRow(ResultSet rs, int rowNum) throws SQLException {
		PermissionVO vo = new PermissionVO();
		vo.setId(rs.getLong("id"));
		vo.setParentId(rs.getLong("parent_id"));
		vo.setName(rs.getString("name"));
		vo.setType(rs.getShort("type"));
		vo.setUrl(rs.getString("url"));
		vo.setMethod(rs.getString("method"));
		vo.setCode(rs.getString("code"));
		String icon = rs.getString("icon");
		vo.setIcon(icon == null ? "" : icon);
		vo.setSortby(rs.getInt("sortby"));
		vo.setMasterShow(rs.getInt("master_show"));

		return vo;
	}

}
